package org.intellij.doctree;

import com.intellij.openapi.ui.DialogWrapper;

import java.awt.*;

public abstract class NodeDialog extends DialogWrapper {

    protected boolean okFlag;
    protected boolean newNode;

    public NodeDialog(Component parent) {
        super(parent, false);
        this.okFlag = false;
    }

    public void doOKAction() {
        if (!isValidated()) return;
        super.doOKAction();
        okFlag = true;
    }

    public void doCancelAction() {
        okFlag = false;
        super.doCancelAction();
    }

    public boolean isOkFlag() {
        return okFlag;
    }

    public abstract Object getValue();

    protected abstract boolean isValidated();

}
